from h3yun.api import business_data_api
from config.h3yun_config import site_change_info_schemaCode, site_info_schemaCode
from config.api_params.bizObject_params import set_LoadBizObjects_params


def find_all_list(schema_code, matchers = []):
    all_list = []
    from_row_num = 0
    # 最多500条  下标从0开始 [0,500)
    to_row_num = 500
    row_range = 500
    while True:
        params = set_LoadBizObjects_params(schema_code=schema_code, from_row_num=from_row_num,
                                           to_row_num=to_row_num, matchers=matchers)
        response = business_data_api.loadBizObjects_api(data=params)
        list = response.json().get("ReturnData")['BizObjectArray']
        all_list.extend(list)
        if len(list) < row_range:
            break
        else:
            from_row_num += row_range
            to_row_num += row_range
    return all_list


